package org.cmg.study.spring.controller;

import org.cmg.study.spring.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author CMG
 * @version 1.0
 * @cLassName UserController
 * @description
 * @date 2021/9/6 10:12
 **/
@Controller
public class UserController {

    @RequestMapping("/test")
    @ResponseBody
    public User test(@RequestBody User user){
        //打印接收的数据
        System.out.println("name = " + user.getName() + ", password = " + user.getPassword() + ", age = "+ user.getAge());
        //返回json格式响应
        return user;
    }
}
